/*
 * Copyright (c) 2016. zhaojin 15398699939@163.com
 */

package com.bankscene.screenfit.fragment;


import com.bankscene.screenfit.adapters.MenusListAdapter;
import com.bankscene.screenfit.events.ItemSelectedEvent;
import com.bankscene.screenfit.vus.MenusListVu;
import com.bankscene.screenfit.vus.VuCallback;

public class MenusListFragment extends BasePresenterFragment<MenusListVu> {

    MenusListAdapter adapter = new MenusListAdapter();
    VuCallback<Integer> selectCallback = new VuCallback<Integer>() {
        @Override
        public void execute(Integer result) {
            bus.postSticky(new ItemSelectedEvent(adapter.getTitle(result)));
        }
    };

    @Override
    protected void onBindVu() {
        vu.setListAdapter(adapter);
        vu.setSelectCallback(selectCallback);
    }

    @Override
    protected Class<MenusListVu> getVuClass() {
        return MenusListVu.class;
    }

    public static MenusListFragment newInstance(){
        return new MenusListFragment();
    }

}
